﻿using System;
using System.Collections.Generic;
using SharpSqlAnalyzer.nodes;

namespace SharpSqlAnalyzer
{
	// Token: 0x02000069 RID: 105
	public class TSourceToken
	{
		// Token: 0x17000027 RID: 39
		// (get) Token: 0x06000218 RID: 536 RVA: 0x002D9D5E File Offset: 0x002D7F5E
		// (set) Token: 0x06000219 RID: 537 RVA: 0x002D9D66 File Offset: 0x002D7F66
		public TSourceToken PrevTokenInChain
		{
			get
			{
				return this._prevTokenInChain;
			}
			set
			{
				this._prevTokenInChain = value;
			}
		}

		// Token: 0x17000028 RID: 40
		// (get) Token: 0x0600021A RID: 538 RVA: 0x002D9D6F File Offset: 0x002D7F6F
		// (set) Token: 0x0600021B RID: 539 RVA: 0x002D9D77 File Offset: 0x002D7F77
		public TSourceToken NextTokenInChain
		{
			get
			{
				return this._nextTokenInChain;
			}
			set
			{
				this._nextTokenInChain = value;
			}
		}

		// Token: 0x0600021C RID: 540 RVA: 0x002D9D80 File Offset: 0x002D7F80
		public TSourceToken()
		{
		}

		// Token: 0x0600021D RID: 541 RVA: 0x002D9D9E File Offset: 0x002D7F9E
		public TSourceToken(string s)
		{
			this.astext = s;
		}

		// Token: 0x17000029 RID: 41
		// (get) Token: 0x0600021E RID: 542 RVA: 0x002D9DC3 File Offset: 0x002D7FC3
		// (set) Token: 0x0600021F RID: 543 RVA: 0x002D9DCB File Offset: 0x002D7FCB
		public bool AllowRewrite
		{
			get
			{
				return this._allowRewrite;
			}
			set
			{
				this._allowRewrite = value;
			}
		}

		// Token: 0x1700002A RID: 42
		// (get) Token: 0x06000220 RID: 544 RVA: 0x002D9DD4 File Offset: 0x002D7FD4
		// (set) Token: 0x06000221 RID: 545 RVA: 0x002D9DDC File Offset: 0x002D7FDC
		public bool Changed
		{
			get
			{
				return this._changed;
			}
			set
			{
				if (this._allowRewrite)
				{
					this._changed = value;
				}
			}
		}

		// Token: 0x06000222 RID: 546 RVA: 0x002D9DED File Offset: 0x002D7FED
		public string toScript()
		{
			return this.astext;
		}

		// Token: 0x06000223 RID: 547 RVA: 0x002D9DF5 File Offset: 0x002D7FF5
		public void setLinkToken(TSourceToken st)
		{
			this.LinkToken = st;
		}

		// Token: 0x1700002B RID: 43
		// (get) Token: 0x06000224 RID: 548 RVA: 0x002D9E00 File Offset: 0x002D8000
		public virtual string TextWithoutQuoted
		{
			get
			{
				if (this.ToString().StartsWith("'", StringComparison.Ordinal) || this.ToString().StartsWith("[", StringComparison.Ordinal))
				{
					return this.ToString().Substring(1, this.ToString().Length - 1 - 1);
				}
				return this.ToString();
			}
		}

		// Token: 0x1700002C RID: 44
		// (get) Token: 0x06000225 RID: 549 RVA: 0x002D9E55 File Offset: 0x002D8055
		// (set) Token: 0x06000226 RID: 550 RVA: 0x002D9E5D File Offset: 0x002D805D
		public virtual TGSharpSqlParser GSharpSqlParser
		{
			get
			{
				return this.gSharpSqlParser;
			}
			set
			{
				this.gSharpSqlParser = value;
			}
		}

		// Token: 0x1700002D RID: 45
		// (get) Token: 0x06000227 RID: 551 RVA: 0x002D9E66 File Offset: 0x002D8066
		public List<TParseTreeNode> nodesStartFromThisToken
		{
			get
			{
				return this._nodesStartFromThisToken;
			}
		}

		// Token: 0x1700002E RID: 46
		// (get) Token: 0x06000228 RID: 552 RVA: 0x002D9E6E File Offset: 0x002D806E
		public List<TParseTreeNode> nodesEndWithThisToken
		{
			get
			{
				return this._nodesEndWithThisToken;
			}
		}

		// Token: 0x1700002F RID: 47
		// (get) Token: 0x0600022A RID: 554 RVA: 0x002D9E7F File Offset: 0x002D807F
		// (set) Token: 0x06000229 RID: 553 RVA: 0x002D9E76 File Offset: 0x002D8076
		public virtual EDbObjectType DbObjType
		{
			get
			{
				return this.dbObjType;
			}
			set
			{
				this.dbObjType = value;
			}
		}

		// Token: 0x17000030 RID: 48
		// (get) Token: 0x0600022C RID: 556 RVA: 0x002D9E90 File Offset: 0x002D8090
		// (set) Token: 0x0600022B RID: 555 RVA: 0x002D9E87 File Offset: 0x002D8087
		public virtual TSourceToken AlternativeToken
		{
			get
			{
				return this._alternativeToken;
			}
			set
			{
				this._alternativeToken = value;
			}
		}

		// Token: 0x17000031 RID: 49
		// (get) Token: 0x0600022E RID: 558 RVA: 0x002D9EA1 File Offset: 0x002D80A1
		// (set) Token: 0x0600022D RID: 557 RVA: 0x002D9E98 File Offset: 0x002D8098
		public virtual EDbVendor Dbvendor
		{
			get
			{
				return this.dbvendor;
			}
			set
			{
				this.dbvendor = value;
			}
		}

		// Token: 0x17000032 RID: 50
		// (get) Token: 0x0600022F RID: 559 RVA: 0x002D9EA9 File Offset: 0x002D80A9
		// (set) Token: 0x06000230 RID: 560 RVA: 0x002D9EB1 File Offset: 0x002D80B1
		public virtual string String
		{
			get
			{
				return this.astext;
			}
			set
			{
				this.astext = value;
			}
		}

		// Token: 0x06000231 RID: 561 RVA: 0x002D9EBA File Offset: 0x002D80BA
		public override string ToString()
		{
			return this.astext;
		}

		// Token: 0x06000232 RID: 562 RVA: 0x002D9EC4 File Offset: 0x002D80C4
		public virtual string toStringDebug()
		{
			string text = string.Concat(new string[]
			{
				this.lineNo.ToString(),
				",",
				this.columnNo.ToString(),
				",",
				this.astext.Length.ToString(),
				",",
				this.offset.ToString(),
				",",
				this.tokencode.ToString(),
				" ",
				this.tokentype.ToString()
			});
			if (this.tokencode == 257)
			{
				text += " multi line comment";
			}
			else if (this.tokencode == 258)
			{
				text += " single line comment";
			}
			else if (this.tokencode == 259)
			{
				text += " space";
			}
			else if (this.tokencode == 260)
			{
				text += " newline";
			}
			else
			{
				text = text + " " + this.astext;
			}
			return text;
		}

		// Token: 0x06000233 RID: 563 RVA: 0x002D9FE9 File Offset: 0x002D81E9
		public static bool isnonsolidtoken(ETokenType tokentype)
		{
			return tokentype == ETokenType.ttwhitespace || tokentype == ETokenType.ttreturn || tokentype == ETokenType.ttsimplecomment || tokentype == ETokenType.ttbracketedcomment;
		}

		// Token: 0x06000234 RID: 564 RVA: 0x002D9FFD File Offset: 0x002D81FD
		public virtual bool isnonsolidtoken()
		{
			return !this.issolidtoken();
		}

		// Token: 0x06000235 RID: 565 RVA: 0x002DA008 File Offset: 0x002D8208
		public virtual bool issolidtoken()
		{
			return !TSourceToken.isnonsolidtoken(this.tokentype);
		}

		// Token: 0x17000033 RID: 51
		// (get) Token: 0x06000236 RID: 566 RVA: 0x002DA018 File Offset: 0x002D8218
		public virtual TSourceTokenList TokensAfter
		{
			get
			{
				if (this.tokensAfter == null)
				{
					this.tokensAfter = new TSourceTokenList();
				}
				return this.tokensAfter;
			}
		}

		// Token: 0x17000034 RID: 52
		// (get) Token: 0x06000237 RID: 567 RVA: 0x002DA033 File Offset: 0x002D8233
		public virtual TSourceTokenList TokensBefore
		{
			get
			{
				if (this.tokensBefore == null)
				{
					this.tokensBefore = new TSourceTokenList();
				}
				return this.tokensBefore;
			}
		}

		// Token: 0x17000035 RID: 53
		// (get) Token: 0x06000239 RID: 569 RVA: 0x002DA057 File Offset: 0x002D8257
		// (set) Token: 0x06000238 RID: 568 RVA: 0x002DA04E File Offset: 0x002D824E
		public virtual TSourceToken ReplaceToken
		{
			get
			{
				return this.replaceToken;
			}
			set
			{
				this.replaceToken = value;
			}
		}

		// Token: 0x0600023A RID: 570 RVA: 0x002DA060 File Offset: 0x002D8260
		public virtual TSourceToken searchToken(int targetTokenCode, int range)
		{
			TSourceToken result = null;
			if (this.container == null)
			{
				return result;
			}
			return this.container.searchToken(targetTokenCode, "", this, range);
		}

		// Token: 0x0600023B RID: 571 RVA: 0x002DA08C File Offset: 0x002D828C
		public virtual TSourceToken searchToken(string targetTokenText, int range)
		{
			TSourceToken result = null;
			if (this.container == null)
			{
				return result;
			}
			return this.container.searchToken(0, targetTokenText, this, range);
		}

		// Token: 0x0600023C RID: 572 RVA: 0x002DA0B4 File Offset: 0x002D82B4
		public virtual TSourceToken searchTokenAfterObjectName()
		{
			TSourceToken result = null;
			if (this.container == null)
			{
				return result;
			}
			int num = this.container.nextObjectNameToken(this.posinlist, 1, false);
			if (num == -1)
			{
				return result;
			}
			return this.container.get(num).nextSolidToken();
		}

		// Token: 0x0600023D RID: 573 RVA: 0x002DA0F8 File Offset: 0x002D82F8
		public virtual TSourceToken nextSolidToken()
		{
			TSourceToken result = null;
			if (this.container == null)
			{
				return result;
			}
			return this.container.nextsolidtoken(this, 1, false);
		}

		// Token: 0x0600023E RID: 574 RVA: 0x002DA120 File Offset: 0x002D8320
		public virtual TSourceToken prevSolidToken()
		{
			TSourceToken result = null;
			if (this.container == null)
			{
				return result;
			}
			return this.container.nextsolidtoken(this, -1, false);
		}

		// Token: 0x0600023F RID: 575 RVA: 0x002DA148 File Offset: 0x002D8348
		public virtual bool firstTokenOfLine()
		{
			TSourceToken tsourceToken = this.prevSolidToken();
			return tsourceToken == null || tsourceToken.lineNo != this.lineNo;
		}

		// Token: 0x06000240 RID: 576 RVA: 0x002DA174 File Offset: 0x002D8374
		public virtual bool lastTokenOfLine()
		{
			TSourceToken tsourceToken = this.nextSolidToken();
			return tsourceToken == null || tsourceToken.lineNo != this.lineNo;
		}

		// Token: 0x06000241 RID: 577 RVA: 0x002DA1A0 File Offset: 0x002D83A0
		public virtual int removeMyFromTokenList()
		{
			int result = -1;
			TSourceTokenList tsourceTokenList = this.container;
			if (tsourceTokenList == null)
			{
				return result;
			}
			int num = this.posinlist;
			tsourceTokenList.remove(num);
			for (int i = num; i < tsourceTokenList.size(); i++)
			{
				tsourceTokenList.get(i).posinlist = i;
			}
			return 1;
		}

		// Token: 0x17000036 RID: 54
		// (get) Token: 0x06000243 RID: 579 RVA: 0x002DA1F8 File Offset: 0x002D83F8
		// (set) Token: 0x06000242 RID: 578 RVA: 0x002DA1E8 File Offset: 0x002D83E8
		public virtual TSourceToken LinkToken
		{
			get
			{
				return this.linkToken;
			}
			set
			{
				this.linkToken = value;
				value.linkToken = this;
			}
		}

		// Token: 0x06000244 RID: 580 RVA: 0x002DA200 File Offset: 0x002D8400
		public virtual string toUnQuotedString()
		{
			if (this.tokentype == ETokenType.ttdqstring || this.tokentype == ETokenType.ttdbstring || this.tokentype == ETokenType.ttbrstring)
			{
				return this.ToString().Substring(1, this.ToString().Length - 1 - 1);
			}
			if (this.dbvendor == EDbVendor.dbvmysql && this.ToString().StartsWith("`", StringComparison.Ordinal))
			{
				return this.ToString().Substring(1, this.ToString().Length - 1 - 1);
			}
			return this.ToString();
		}

		// Token: 0x04001044 RID: 4164
		private TSourceToken _prevTokenInChain;

		// Token: 0x04001045 RID: 4165
		private TSourceToken _nextTokenInChain;

		// Token: 0x04001046 RID: 4166
		private bool _changed;

		// Token: 0x04001047 RID: 4167
		private bool _allowRewrite;

		// Token: 0x04001048 RID: 4168
		private TGSharpSqlParser gSharpSqlParser;

		// Token: 0x04001049 RID: 4169
		public int tokencode;

		// Token: 0x0400104A RID: 4170
		public long lineNo;

		// Token: 0x0400104B RID: 4171
		public long columnNo;

		// Token: 0x0400104C RID: 4172
		public long offset;

		// Token: 0x0400104D RID: 4173
		public ETokenType tokentype;

		// Token: 0x0400104E RID: 4174
		public TSourceTokenList container;

		// Token: 0x0400104F RID: 4175
		public int posinlist;

		// Token: 0x04001050 RID: 4176
		public string astext;

		// Token: 0x04001051 RID: 4177
		public ETokenStatus tokenstatus;

		// Token: 0x04001052 RID: 4178
		public string dolqstart;

		// Token: 0x04001053 RID: 4179
		internal string prevsourcecode;

		// Token: 0x04001054 RID: 4180
		internal bool insqlpluscmd;

		// Token: 0x04001055 RID: 4181
		private List<TParseTreeNode> _nodesStartFromThisToken = new List<TParseTreeNode>();

		// Token: 0x04001056 RID: 4182
		private List<TParseTreeNode> _nodesEndWithThisToken = new List<TParseTreeNode>();

		// Token: 0x04001057 RID: 4183
		public TCustomSqlStatement stmt;

		// Token: 0x04001058 RID: 4184
		public int tag;

		// Token: 0x04001059 RID: 4185
		private EDbObjectType dbObjType;

		// Token: 0x0400105A RID: 4186
		private TSourceToken _alternativeToken;

		// Token: 0x0400105B RID: 4187
		private EDbVendor dbvendor;

		// Token: 0x0400105C RID: 4188
		private TSourceTokenList tokensBefore;

		// Token: 0x0400105D RID: 4189
		private TSourceTokenList tokensAfter;

		// Token: 0x0400105E RID: 4190
		private TSourceToken replaceToken;

		// Token: 0x0400105F RID: 4191
		private TSourceToken linkToken;
	}
}
